impr: Ignore console.logs in vertex shaders#1985
Merged
aleksanderkatan merged 31 commits intomainfrom Jan 29, 2026
Merged
Conversation
|
pkg.pr.new packages benchmark commit |
added 9 commits
December 16, 2025 15:31
There was a problem hiding this comment.
Pull request overview
This PR improves error handling when console.log is used in vertex shaders by detecting the shader stage during resolution and throwing a clear error instead of allowing invalid code generation.
Key changes:
- Replaces the
isEntryboolean flag with anentryPointstring field to distinguish between shader stages ('vertex', 'fragment', 'compute') - Tracks the current shader stage during resolution and validates
console.logusage - Removes the deprecated
doesmethod from entry point function shells
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/typegpu/src/types.ts | Adds ShaderStage type definition for tracking shader stages |
| packages/typegpu/src/resolutionCtx.ts | Implements stage tracking logic and validates console.log usage based on current stage |
| packages/typegpu/src/core/function/tgpuVertexFn.ts | Replaces isEntry with entryPoint: 'vertex' and adds type guard |
| packages/typegpu/src/core/function/tgpuFragmentFn.ts | Replaces isEntry with entryPoint: 'fragment' and adds type guard |
| packages/typegpu/src/core/function/tgpuFn.ts | Removes unused isEntry: false from regular functions |
| packages/typegpu/src/core/function/tgpuComputeFn.ts | Replaces isEntry with entryPoint: 'compute' and adds type guard |
| packages/typegpu/tests/tgsl/consoleLog.test.ts | Adds test coverage for vertex shader console.log error handling |
| apps/typegpu-docs/src/examples/rendering/3d-fish/render.ts | Demonstrates the error by adding a console.log in a vertex shader |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
added 2 commits
December 16, 2025 17:08
…-logging-from-vertex
iwoplaza
reviewed
Dec 22, 2025
added 2 commits
January 15, 2026 12:01
…-logging-from-vertex
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:
📋 All resultsClick to reveal the results table (334 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
cieplypolar
approved these changes
Jan 15, 2026
Collaborator
cieplypolar
left a comment
There was a problem hiding this comment.
LGTM! First internal slot 😊
Co-authored-by: Szymon Szulc <103948576+cieplypolar@users.noreply.github.com>
…-logging-from-vertex
…-logging-from-vertex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before:

After:

Changes:
isEntryfrom all functions shells (it was unused),entryPointto make entry functions differentiable,